getPageOfMemo(1);
function getPageOfMemo(page) {
    $.ajax({
        url: "/toPage",
        type: "POST",
        dataType: "json",
        data: {"page": page},
        async: false,
        success: function (data) {
            var totalPages=data.pages;
            var htm = "";
            for (let i = 0; i < data.list.length; i++) {
                var date=new Date(data.list[i].gmtCreate);
                var year=date.getFullYear();
                var month=date.getMonth()+1;
                var day=date.getDate();
                var hour=date.getHours();
                var min=date.getMinutes();
                var second=date.getSeconds();
                var str=year+"-"+month+"-"+day+" "+hour+":"+min+":"+second;
                // console.log(data.list[i]);
                htm += "<div class='media'>";
                htm += "<div class='media-left'>";
                htm += "<a href='#'>";
                htm += "<img class='media-object img-rounded' src='" + data.list[i].user.avatarUrl + "'>";
                htm += "</a>";
                htm += "</div>";
                htm += "<div class='media-body'>";
                htm += "<h4 class='media-heading'><a href='/question/"+data.list[i].id+"'>" + data.list[i].title + "</a></h4>";
                htm += "<span class='text-desc'>";
                htm += "• <span>" + data.list[i].commentCount + "</span>个回复";
                htm += "• <span>" + data.list[i].viewCount + "</span>次浏览";
                htm += "• <span>" + str + "</span>";
                htm += "</span>";
                htm += "</div>";
                htm += "</div>";
            }
            $('.media').html(htm);

            var element = $('#pageLimit');
            var options = {
                bootstrapMajorVersion: 3,
                currentPage: page,
                numberOfPages: 5,
                totalPages: totalPages,
                itemsTexts: function (type, page, current) {
                    switch (type) {
                        case "first":
                            return "首页";
                        case "prev":
                            return "上一页";
                        case "next":
                            return "下一页";
                        case "last":
                            return "末页";
                        case "page":
                            return page;
                    }
                },
                onPageClicked: function (event, originalEvent, type, page) {
                    getPageOfMemo(page);
                }
            };
            element.bootstrapPaginator(options);
        }

    });

}
